'use strict';
module.exports = {
	/**
	 * 查询模版列表
	 * @url client/template/pub/getTemplate 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: "" };
		// // 业务逻辑开始-----------------------------------------------------------
		const dbName = "avatar-template";

		const { templateId } = data;
		if (!templateId) {
		  return { code: 400, msg: '参数错误' };
		}

		try {
		  res = await vk.baseDao.findByWhereJson({
			dbName,
			whereJson:{
			  template_id: templateId,
			}
		  });
		} catch(err){
		  console.log(error)
		  res = { code: 500, msg: "查询错误" };
		}

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
